home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / PDReadStatus.z / PDReadStatus
Text File  |  1998-10-30  |  23KB  |  397 lines

  1.  
  2.  
  3.  
  4. PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      PDReadStatus, PDReadOpStatus, PDLocalReadStatus, PDLocalReadOpStatus,
  10.      PDLocalWriteStatus - reads/writes the printer status
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ppppoooodddd....hhhh>>>>
  14.  
  15.      iiiinnnntttt PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
  16.                       PPPPDDDDSSSSttttaaaattttuuuussssSSSSttttrrrruuuucccctttt ********ssssttttaaaattttuuuusssspppp,,,,
  17.                       PPPPDDDDMMMMeeeessssssssaaaaggggeeeeSSSSttttrrrruuuucccctttt ********mmmmeeeessssssssaaaaggggeeeesssspppp,,,,
  18.                       ttttiiiimmmmeeee____tttt ****mmmmoooodddd____ttttiiiimmmmeeeepppp))));;;;
  19.  
  20.      iiiinnnntttt PPPPDDDDLLLLooooccccaaaallllRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
  21.                            PPPPDDDDSSSSttttaaaattttuuuussssSSSSttttrrrruuuucccctttt ********ssssttttaaaattttuuuusssspppp,,,,
  22.                            PPPPDDDDMMMMeeeessssssssaaaaggggeeeeSSSSttttrrrruuuucccctttt ********mmmmeeeessssssssaaaaggggeeeesssspppp,,,,
  23.                            ttttiiiimmmmeeee____tttt ****mmmmoooodddd____ttttiiiimmmmeeeepppp))));;;;
  24.  
  25.      iiiinnnntttt PPPPDDDDRRRReeeeaaaaddddOOOOppppSSSSttttaaaattttuuuussss((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
  26.                         iiiinnnntttt ****oooopppp____ssssttttaaaattttuuuusssspppp,,,,
  27.                         ttttiiiimmmmeeee____tttt ****mmmmoooodddd____ttttiiiimmmmeeeepppp))));;;;
  28.  
  29.      iiiinnnntttt PPPPDDDDLLLLooooccccaaaallllRRRReeeeaaaaddddOOOOppppSSSSttttaaaattttuuuussss((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
  30.                              iiiinnnntttt ****oooopppp____ssssttttaaaattttuuuusssspppp,,,,
  31.                              ttttiiiimmmmeeee____tttt ****mmmmoooodddd____ttttiiiimmmmeeeepppp))));;;;
  32.  
  33.      iiiinnnntttt PPPPDDDDLLLLooooccccaaaallllWWWWrrrriiiitttteeeeSSSSttttaaaattttuuuussss((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****pppprrrriiiinnnntttteeeerrrr____nnnnaaaammmmeeee,,,,
  34.                             PPPPDDDDSSSSttttaaaattttuuuussssSSSSttttrrrruuuucccctttt ****ssssttttaaaattttuuuussss,,,,
  35.                             PPPPDDDDMMMMeeeessssssssaaaaggggeeeeSSSSttttrrrruuuucccctttt ****mmmmeeeessssssssaaaaggggeeeessss))));;;;
  36.  
  37. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  38.      _P_D_R_e_a_d_S_t_a_t_u_s and _P_D_L_o_c_a_l_R_e_a_d_S_t_a_t_u_s provide detailed information on the
  39.      operational status of the specified printer, _p_r_i_n_t_e_r__n_a_m_e. The functions
  40.      fill and return a _P_D_S_t_a_t_u_s_S_t_r_u_c_t with status information and return an
  41.      array of _P_D_M_e_s_s_a_g_e_S_t_r_u_c_t messages. The message list consists of errors,
  42.      warnings and general information related to the current operational
  43.      condition of the printer. The number of messages in the list is given by
  44.      the _e_r_r_o_r__c_o_u_n_t field of the _P_D_S_t_a_t_u_s_S_t_r_u_c_t. There will be a maximum of
  45.      PPPPDDDD____MMMMEEEESSSSSSSSAAAAGGGGEEEE____MMMMAAAAXXXX messages in the list. If _e_r_r_o_r__c_o_u_n_t is 0, the value of
  46.      _m_e_s_s_a_g_e_s_p is undefined.
  47.  
  48.      _P_D_R_e_a_d_O_p_S_t_a_t_u_s and _P_D_L_o_c_a_l_R_e_a_d_O_p_S_t_a_t_u_s also provide printer status
  49.      information. However, only the _o_p_e_r_a_t_i_o_n_a_l__s_t_a_t_u_s field of the
  50.      _P_D_S_t_a_t_u_s_S_t_r_u_c_t is returned.
  51.  
  52.      The status reading functions all set _m_o_d__t_i_m_e_p to the time the printer
  53.      status information was last modified (see _t_i_m_e(_2)).
  54.  
  55.      _P_D_L_o_c_a_l_W_r_i_t_e_S_t_a_t_u_s writes the specified _P_D_S_t_a_t_u_s_S_t_r_u_c_t and
  56.      _P_D_M_e_s_s_a_g_e_S_t_r_u_c_t information to the specified printer's status file.
  57.      _m_e_s_s_a_g_e_s is expected to be an array of message structures. The number of
  58.      messages in the array must be the same as the number in the _e_r_r_o_r__c_o_u_n_t
  59.      field of the _P_D_S_t_a_t_u_s_S_t_r_u_c_t and must not exceed PPPPDDDD____MMMMEEEESSSSSSSSAAAAGGGGEEEE____MMMMAAAAXXXX. If there
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))
  71.  
  72.  
  73.  
  74.      are no messages to write, _m_e_s_s_a_g_e_s may be specified as NNNNUUUULLLLLLLL. _l_i_b_p_o_d
  75.      provides the _P_D_M_a_k_e_M_e_s_s_a_g_e convenience function to assist in filling a
  76.      _P_D_M_e_s_s_a_g_e_S_t_r_u_c_t.
  77.  
  78.      Refer to the _l_i_b_p_o_d(_3) man page for information about the "Local"
  79.      functions.
  80.  
  81.      The _P_D_S_t_a_t_u_s_S_t_r_u_c_t structure is defined as follows.
  82.  
  83.           typedef struct _pdStatusStruct {
  84.               int  operational_status;          /* Printer status */
  85.               int  error_count;                 /* Number of messages */
  86.                                                 /* error, warning & info */
  87.               int  media_type;                  /* Media type */
  88.               int  number_of_colors;            /* Number of colors */
  89.               int  media_size;                  /* Media size */
  90.               char printer_options[PD_STR_MAX]; /* Option info */
  91.                                                 /* (e.g. "8 MB RAM") */
  92.               char validation_mask;             /* Size validation mask */
  93.           } PDStatusStruct;
  94.  
  95.  
  96.      _o_p_e_r_a_t_i_o_n_a_l__s_t_a_t_u_s  Code indicating the operational status of the printer
  97.                          (see _p_o_d._h).
  98.  
  99.      _e_r_r_o_r__c_o_u_n_t         Total number of error, warning and information
  100.                          messages available in the _e_r_r__s_t_a_t_u_s field of the
  101.                          _P_D_I_n_f_o_S_t_r_u_c_t and in the _m_e_s_s_a_g_e_s_p array returned by
  102.                          _P_D_R_e_a_d_S_t_a_t_u_s and _P_D_L_o_c_a_l_R_e_a_d_S_t_a_t_u_s. When calling
  103.                          _P_D_L_o_c_a_l_W_r_i_t_e_S_t_a_t_u_s the number of message specified by
  104.                          this field must match the number of messages in the
  105.                          _m_e_s_s_a_g_e_s_p array and must not exceed PPPPDDDD____MMMMEEEESSSSSSSSAAAAGGGGEEEE____MMMMAAAAXXXX.
  106.  
  107.      _m_e_d_i_a__t_y_p_e          Code indicating the media type installed in the
  108.                          printer (see _p_o_d._h).
  109.  
  110.      _n_u_m_b_e_r__o_f__c_o_l_o_r_s    This field is a bitmask in which the number of
  111.                          colors, colorspace, pixel depth and data format are
  112.                          specified. The value for this field is constructed by
  113.                          bitwise OR'ing the values for each of these
  114.                          attributes. The bitmasks used in this field are all
  115.                          prefixed PPPPDDDD____DDDDAAAATTTTAAAA____ and can be found in _p_o_d._h. Refer to
  116.                          this file for a list of all possible bitmasks.  For
  117.                          example, to specify an RGB colorspace with eight bits
  118.                          per pixel and a planar data format set this field to
  119.                          PPPPDDDD____DDDDAAAATTTTAAAA____PPPPLLLLAAAANNNNAAAARRRR |||| PPPPDDDD____DDDDAAAATTTTAAAA____DDDDEEEEPPPPTTTTHHHH8888 |||| PPPPDDDD____DDDDAAAATTTTAAAA____RRRRGGGGBBBB. The
  120.                          default values for these fields are PPPPDDDD____DDDDAAAATTTTAAAA____KKKK,
  121.                          PPPPDDDD____DDDDAAAATTTTAAAA____DDDDEEEEPPPPTTTTHHHH1111 and PPPPDDDD____DDDDAAAATTTTAAAA____CCCCHHHHUUUUNNNNKKKKYYYY.  Macros are
  122.                          provided to decompose this field into its component
  123.                          codes. For example, to determine the data depth the
  124.                          macro PPPPDDDD____GGGGEEEETTTT____DDDDEEEEPPPPTTTTHHHH____CCCCOOOODDDDEEEE((((nnnnuuuummmmbbbbeeeerrrr____ooooffff____ccccoooolllloooorrrrssss)))) would be
  125.                          used. Refer to _p_o_d._h for a list of these macros.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))
  137.  
  138.  
  139.  
  140.      _m_e_d_i_a__s_i_z_e          Media size code (see _p_o_d._h).
  141.  
  142.      _p_r_i_n_t_e_r__o_p_t_i_o_n_s     Installed printer options (e.g. "8 MByte RAM"). This
  143.                          string is also used to indicate the current printer
  144.                          resolution for printers that support multiple output
  145.                          resolutions. While the _P_D_I_n_f_o_S_t_r_u_c_t contains a
  146.                          resolution field, typically the nominal resolution is
  147.                          stated. To specify the current resolution place
  148.                          "CurrentRes = <xres> x <yres>" in this string. <xres>
  149.                          and <yres> should be replaced with the current output
  150.                          resolution. Note that the 'x' can be specified as 'X'
  151.                          or ',' and whitespace before and after the character
  152.                          is optional. Printer drivers should update this
  153.                          string and filter programs that require the current
  154.                          output resolution should parse for this string before
  155.                          falling back to using the resolutions in the
  156.                          _P_D_I_n_f_o_S_t_r_u_c_t. If a resolution string is not specified
  157.                          in this field, the resolution is assumed to be that
  158.                          specified in the _P_D_I_n_f_o_S_t_r_u_c_t. The convenience
  159.                          function _P_D_G_e_t_C_u_r_r_e_n_t_R_e_s_o_l_u_t_i_o_n(_3) performs the above
  160.                          procedure and returns the current output resolution.
  161.  
  162.      _v_a_l_i_d_a_t_i_o_n__m_a_s_k     Size table entry validation mask. If _P_D_F_i_n_d_P_a_g_e_S_i_z_e
  163.                          is called with a size code of PPPPDDDD____SSSSIIIIZZZZEEEE____CCCCUUUURRRRRRRREEEENNNNTTTT,
  164.                          dimensional information for the currently loaded
  165.                          paper size will be returned. The mechanics of
  166.                          determining this information is as follows. The
  167.                          _m_e_d_i_a__s_i_z_e field of the _P_D_S_t_a_t_u_s_S_t_r_u_c_t is used as the
  168.                          size code to search the page table in the
  169.                          _P_D_I_n_f_o_S_t_r_u_c_t. This table contains size information
  170.                          for each page size the printer supports. Each page
  171.                          table entry has a validation mask as well as a size
  172.                          code. Dimensional information is returned for the
  173.                          page size entry that matches the _m_e_d_i_a__s_i_z_e value and
  174.                          whose validation masks satisfy the relationship
  175.                          (_s_t_a_t_u_s _m_a_s_k & _t_a_b_l_e _m_a_s_k) == _s_t_a_t_u_s _m_a_s_k.  The
  176.                          validation mask can be helpful in specifying page
  177.                          dimensions for printers that support multiple
  178.                          resolutions.  The page table can contain a number of
  179.                          page names that are identical but with dimensions
  180.                          appropriate to different resolutions. Each entry
  181.                          would have a unique validation mask. This way the
  182.                          status validation mask could be used to select the
  183.                          proper page size for the current output resolution.
  184.  
  185.      The _P_D_M_e_s_s_a_g_e_S_t_r_u_c_t is defined as follows.
  186.  
  187.           typedef struct _pdMessageStruct {
  188.               int message_code;
  189.               char message_text[PD_STR_MAX];
  190.           } PDMessageStruct;
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))
  203.  
  204.  
  205.  
  206.      _m_e_s_s_a_g_e__c_o_d_e        Error, warning or information message code ID (see
  207.                          _p_o_d._h).
  208.  
  209.      _m_e_s_s_a_g_e__t_e_x_t        Text for the message truncated to a length of
  210.                          PD_STR_MAX-1.
  211.  
  212. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  213.      0 is returned if execution was successful. -1 is returned and _P_D_e_r_r_n_o is
  214.      set if an execution error has occurred.
  215.  
  216. EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN EEEERRRRRRRROOOORRRR CCCCOOOODDDDEEEESSSS
  217.      _P_D_L_o_c_a_l_R_e_a_d_S_t_a_t_u_s, _P_D_L_o_c_a_l_R_e_a_d_O_p_S_t_a_t_u_s, _P_D_R_e_a_d_S_t_a_t_u_s and _P_D_R_e_a_d_O_p_S_t_a_t_u_s
  218.      will fail under the following circumstances.
  219.  
  220.      PD_LIBERR_BAD_PNAME      A NULL or empty printer name string has been
  221.                               specified.
  222.  
  223.      PD_LIBERR_STATUS_READ    The status file could not be opened for reading
  224.                               or an error occurred while reading the file.
  225.  
  226.      In addition, _P_D_R_e_a_d_S_t_a_t_u_s and _P_D_R_e_a_d_O_p_S_t_a_t_u_s will fail under the
  227.      following circumstances.
  228.  
  229.      PD_LIBERR_NO_PRINTER     The specified printer has not been registered
  230.                               with the printer spooling system and is,
  231.                               therefore, inaccessible.
  232.  
  233.      PD_LIBERR_BAD_HOSTNAME   The network address of the specified hostname
  234.                               could not be found.
  235.  
  236.      PD_LIBERR_NETWORK        For an unknown reason, a network connection
  237.                               could not be made with the remote printer host.
  238.  
  239.  
  240.      PD_LIBERR_NET_TIMEOUT    A timeout occurred while attempting to
  241.                               communicate with the remote printer host.
  242.  
  243.      PD_LIBERR_NET_INTR       The program has been interrupted while
  244.                               attempting to communicate with the remote
  245.                               printer host.
  246.  
  247.      PD_LIBERR_NET_NOTREG     The podd daemon is not registered on the remote
  248.                               printer host.
  249.  
  250.      PD_LIBERR_NET_PMAP       The port mapper daemon failed on the remote
  251.                               printer host.
  252.  
  253.      PD_LIBERR_NET_NOPROC     The client has called a libpod function that is
  254.                               not supported by the podd daemon on the remote
  255.                               printer host.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))
  269.  
  270.  
  271.  
  272.      PD_LIBERR_NET_CLNTXDR    The libpod library XDR routines and the kernel's
  273.                               XDR routines are incompatible.
  274.  
  275.      PD_LIBERR_NET_SVCXDR     The podd daemon XDR routines and the remote
  276.                               printer host's kernel XDR routines are
  277.                               incompatible.
  278.  
  279.      PD_LIBERR_NET_RPCMATCH   The version of RPC software on the client is
  280.                               incompatible with the version on the remote
  281.                               printer host.
  282.  
  283.      PD_LIBERR_NET_PROCMATCH  The version of the specified libpod function on
  284.                               the client is incompatible with the version on
  285.                               the remote printer host.
  286.  
  287.      _P_D_L_o_c_a_l_W_r_i_t_e_S_t_a_t_u_s will fail under the following circumstances.
  288.  
  289.      PD_LIBERR_BAD_STRUCT     A NULL structure pointer has been specified.
  290.  
  291.      PD_LIBERR_BAD_PNAME      A NULL or empty printer name string has been
  292.                               specified.
  293.  
  294.      PD_LIBERR_STATUS_WRITE   The status file could not be opened for writing
  295.                               or an error occurred while writing the file.
  296.  
  297.      PD_LIBERR_MAX_MESSAGE    A request has been made to write more than
  298.                               PPPPDDDD____MMMMEEEESSSSSSSSAAAAGGGGEEEE____MMMMAAAAXXXX messages to the status file.
  299.  
  300.      PD_LIBERR_BAD_MSGCNT     An invalid value has been specified for the
  301.                               number of messages to write to the status file.
  302.  
  303.  
  304. WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
  305.      1.   Upon successful execution, the _P_D_R_e_a_d_S_t_a_t_u_s and _P_D_L_o_c_a_l_R_e_a_d_S_t_a_t_u_s
  306.           functions sets _s_t_a_t_u_s_p and _m_e_s_s_a_g_e_s_p to point to internal copies of
  307.           the _P_D_S_t_a_t_u_s_S_t_r_u_c_t and _P_D_M_e_s_s_a_g_e_s_S_t_r_u_c_t list respectively. The
  308.           contents of these structures can change after each _l_i_b_p_o_d function
  309.           call.  To preserve the contents of the structures across subsequent
  310.           _l_i_b_p_o_d calls, they should be copied into user-allocated storage.
  311.  
  312.      2.   The functions _P_D_R_e_a_d_S_t_a_t_u_s and _P_D_R_e_a_d_O_p_S_t_a_t_u_s call the _l_i_b_s_p_o_o_l
  313.           function _S_L_G_e_t_P_r_i_n_t_e_r_I_n_f_o. This _l_i_b_s_p_o_o_l function is not reentrant.
  314.           This means that any pointer returned by a previous call to
  315.           _S_L_G_e_t_P_r_i_n_t_e_r_I_n_f_o will be invalid after a call to either _P_D_R_e_a_d_S_t_a_t_u_s
  316.           or _P_D_R_e_a_d_O_p_S_t_a_t_u_s.
  317.  
  318. NNNNOOOOTTTTEEEESSSS
  319.      1.   Since the POD files are owned by the lp account, super-user or lp
  320.           account privilege is required to successfully call the
  321.           _P_D_L_o_c_a_l_W_r_i_t_e_S_t_a_t_u_s function.
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))                  IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                   PPPPDDDDRRRReeeeaaaaddddSSSSttttaaaattttuuuussss((((3333))))
  335.  
  336.  
  337.  
  338.      2.   The _P_D_L_o_c_a_l_W_r_i_t_e_S_t_a_t_u_s function writes to the status file only if
  339.           the status information and messages in the file differ from those
  340.           specified as parameters to the function. The modification time of
  341.           the status file is updated only if a write takes place.
  342.  
  343. FFFFIIIILLLLEEEESSSS
  344.      /var/spool/lp/pod/[printer name].status
  345.  
  346. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  347.      PDMakeMessage(3), PDReadInfo(3), libpod(3), time(2), ctime(3)
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.